<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>发布公告 - 1024导航管理后台</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link href="https://cdn.jsdelivr.net.net/npm/font-awesome@4.7.0/css/font-awesome.min.css" rel="stylesheet">
    <script>
        tailwind.config = {
            theme: {
                extend: {
                    colors: {
                        primary: '#3B82F6',
                        secondary: '#10B981',
                        accent: '#F59E0B',
                        dark: '#1F2937',
                        light: '#F9FAFB',
                        danger: '#EF4444'
                    },
                    fontFamily: {
                        sans: ['Inter', 'system-ui', 'sans-serif'],
                    },
                }
            }
        }
    </script>
    <style type="text/tailwindcss">
        @layer utilities {
            .content-auto {
                content-visibility: auto;
            }
            .sidebar-active {
                @apply bg-primary/10 text-primary border-l-4 border-primary;
            }
            .btn-action {
                @apply p-1.5 rounded hover:bg-gray-100 transition-colors;
            }
        }
    </style>
</head>

<body class="bg-gray-50 font-sans text-gray-800">
    <div class="flex h-screen overflow-hidden">
        <!-- 侧边栏 -->
        <aside class="w-64 bg-white shadow-sm flex-shrink-0 hidden md:block overflow-y-auto">
            <div class="p-4 border-b border-gray-100">
                <div class="text-primary text-xl font-bold">1024<span class="text-secondary">管理后台</span></div>
            </div>

            <nav class="p-4 space-y-1">
                <a href="admin_index.html"
                    class="flex items-center px-4 py-3 text-sm text-gray-600 hover:bg-gray-50 rounded">
                    <i class="fa fa-tachometer w-5 text-center mr-3"></i>
                    <span>控制台</span>
                </a>
                <a href="admin_resource_manager.html"
                    class="flex items-center px-4 py-3 text-sm text-gray-600 hover:bg-gray-50 rounded">
                    <i class="fa fa-th-large w-5 text-center mr-3"></i>
                    <span>资源管理</span>
                </a>
                <a href="#" class="flex items-center px-4 py-3 text-sm text-gray-600 hover:bg-gray-50 rounded">
                    <i class="fa fa-wrench w-5 text-center mr-3"></i>
                    <span>工具管理</span>
                </a>
                <a href="#" class="flex items-center px-4 py-3 text-sm text-gray-600 hover:bg-gray-50 rounded">
                    <i class="fa fa-users w-5 text-center mr-3"></i>
                    <span>用户管理</span>
                </a>
                <a href="#" class="flex items-center px-4 py-3 text-sm text-gray-600 hover:bg-gray-50 rounded">
                    <i class="fa fa-comments w-5 text-center mr-3"></i>
                    <span>社区内容</span>
                </a>
                <a href="#" class="flex items-center px-4 py-3 text-sm sidebar-active rounded">
                    <i class="fa fa-bullhorn w-5 text-center mr-3"></i>
                    <span>公告管理</span>
                </a>
                <a href="#" class="flex items-center px-4 py-3 text-sm text-gray-600 hover:bg-gray-50 rounded">
                    <i class="fa fa-line-chart w-5 text-center mr-3"></i>
                    <span>数据统计</span>
                </a>

                <div class="border-t border-gray-100 my-3"></div>

                <a href="#" class="flex items-center px-4 py-3 text-sm text-gray-600 hover:bg-gray-50 rounded">
                    <i class="fa fa-cog w-5 text-center mr-3"></i>
                    <span>系统设置</span>
                </a>
                <a href="#" class="flex items-center px-4 py-3 text-sm text-gray-600 hover:bg-gray-50 rounded">
                    <i class="fa fa-question-circle w-5 text-center mr-3"></i>
                    <span>帮助中心</span>
                </a>
            </nav>
        </aside>

        <!-- 主内容区 -->
        <div class="flex-1 flex flex-col overflow-hidden">
            <!-- 顶部导航 -->
            <header class="bg-white shadow-sm z-10">
                <div class="container mx-auto px-4 py-3 flex justify-between items-center">
                    <button class="md:hidden text-gray-600 text-xl">
                        <i class="fa fa-bars"></i>
                    </button>

                    <div class="flex items-center space-x-4 ml-auto">
                        <div class="relative">
                            <button class="text-gray-600 hover:text-primary transition-colors">
                                <i class="fa fa-bell text-xl"></i>
                                <span
                                    class="absolute -top-1 -right-1 w-4 h-4 bg-red-500 rounded-full text-white text-xs flex items-center justify-center">3</span>
                            </button>
                        </div>

                        <div class="relative group">
                            <button
                                class="flex items-center space-x-2 px-3 py-1.5 rounded-full bg-gray-100 hover:bg-gray-200 transition-colors">
                                <img src="https://picsum.photos/id/1005/40/40" alt="管理员头像"
                                    class="w-8 h-8 rounded-full object-cover">
                                <span class="hidden md:inline-block text-sm font-medium">管理员</span>
                                <i class="fa fa-angle-down text-gray-500"></i>
                            </button>
                            <div
                                class="absolute right-0 mt-2 w-48 bg-white rounded-lg shadow-lg py-2 z-10 hidden group-hover:block">
                                <a href="profile.html"
                                    class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">个人中心</a>
                                <a href="settings.html"
                                    class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">账号设置</a>
                                <div class="border-t border-gray-100 my-1"></div>
                                <a href="#" class="block px-4 py-2 text-sm text-red-600 hover:bg-gray-100">退出登录</a>
                            </div>
                        </div>
                    </div>
                </div>
            </header>

            <!-- 页面内容 -->
            <main class="flex-1 overflow-y-auto bg-gray-50 p-4 md:p-6">
                <div class="max-w-4xl mx-auto">
                    <!-- 页面标题 -->
                    <div class="mb-6">
                        <h1 class="text-2xl font-bold text-gray-800">发布公告</h1>
                        <p class="text-gray-500 mt-1">创建和编辑平台公告，向用户传达重要信息</p>
                    </div>

                    <!-- 公告表单 -->
                    <div class="bg-white rounded-xl shadow-sm p-6 mb-6">
                        <form>
                            <div class="mb-6">
                                <label for="title" class="block text-sm font-medium text-gray-700 mb-1">公告标题 <span
                                        class="text-danger">*</span></label>
                                <input type="text" id="title"
                                    class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-primary"
                                    placeholder="请输入公告标题">
                            </div>

                            <div class="mb-6">
                                <label for="type" class="block text-sm font-medium text-gray-700 mb-1">公告类型</label>
                                <select id="type"
                                    class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-primary">
                                    <option value="notice">普通公告</option>
                                    <option value="important">重要通知</option>
                                    <option value="update">系统更新</option>
                                    <option value="event">活动信息</option>
                                </select>
                            </div>

                            <div class="mb-6">
                                <label for="content" class="block text-sm font-medium text-gray-700 mb-1">公告内容 <span
                                        class="text-danger">*</span></label>
                                <textarea id="content" rows="10"
                                    class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-primary"
                                    placeholder="请输入公告详细内容"></textarea>
                                <p class="text-xs text-gray-500 mt-1">
                                    支持简单的HTML标签，如&lt;strong&gt;&lt;/strong&gt;、&lt;a&gt;&lt;/a&gt;等</p>
                            </div>

                            <div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-6">
                                <div>
                                    <label for="startDate"
                                        class="block text-sm font-medium text-gray-700 mb-1">开始时间</label>
                                    <input type="datetime-local" id="startDate"
                                        class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-primary">
                                </div>
                                <div>
                                    <label for="endDate"
                                        class="block text-sm font-medium text-gray-700 mb-1">结束时间</label>
                                    <input type="datetime-local" id="endDate"
                                        class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-primary">
                                </div>
                            </div>

                            <div class="mb-6">
                                <label class="flex items-center">
                                    <input type="checkbox" class="form-checkbox h-5 w-5 text-primary rounded">
                                    <span class="ml-2 text-sm text-gray-700">首页置顶显示</span>
                                </label>
                            </div>

                            <div class="mb-6">
                                <label class="flex items-center">
                                    <input type="checkbox" class="form-checkbox h-5 w-5 text-primary rounded">
                                    <span class="ml-2 text-sm text-gray-700">发送邮件通知所有用户</span>
                                </label>
                                <p class="text-xs text-gray-500 mt-1">仅对重要公告使用，避免过度打扰用户</p>
                            </div>

                            <div class="flex justify-end space-x-3 pt-4 border-t border-gray-100">
                                <button type="button"
                                    class="px-4 py-2 border border-gray-300 rounded-md text-gray-700 hover:bg-gray-50 transition-colors">
                                    预览
                                </button>
                                <button type="button"
                                    class="px-4 py-2 border border-gray-300 rounded-md text-gray-700 hover:bg-gray-50 transition-colors">
                                    保存草稿
                                </button>
                                <button type="submit"
                                    class="px-6 py-2 bg-primary text-white rounded-md hover:bg-primary/90 transition-colors">
                                    发布公告
                                </button>
                            </div>
                        </form>
                    </div>

                    <!-- 历史公告 -->
                    <div class="bg-white rounded-xl shadow-sm overflow-hidden">
                        <div class="p-6 border-b border-gray-100">
                            <div class="flex justify-between items-center">
                                <h2 class="text-lg font-bold text-gray-800">历史公告</h2>
                                <a href="admin_announcements.html" class="text-primary text-sm hover:underline">查看全部</a>
                            </div>
                        </div>

                        <div class="divide-y divide-gray-100">
                            <div class="p-4 hover:bg-gray-50 transition-colors">
                                <div class="flex justify-between items-start">
                                    <div>
                                        <h3 class="font-medium text-gray-800">本站已完成服务器升级</h3>
                                        <p class="text-gray-500 text-sm mt-1 line-clamp-2">
                                            本站已完成服务器升级，访问速度提升50%。新增AI工具分类，欢迎体验！如有任何问题，请联系客服。</p>
                                    </div>
                                    <span
                                        class="px-2 py-1 text-xs font-medium bg-green-100 text-green-800 rounded-full">已发布</span>
                                </div>
                                <div class="flex justify-between items-center mt-3">
                                    <span class="text-gray-500 text-xs">2023-06-15 09:30</span>
                                    <div class="flex space-x-1">
                                        <button class="btn-action text-gray-600 hover:text-primary" title="编辑">
                                            <i class="fa fa-edit"></i>
                                        </button>
                                        <button class="btn-action text-gray-600 hover:text-danger" title="删除">
                                            <i class="fa fa-trash"></i>
                                        </button>
                                    </div>
                                </div>
                            </div>

                            <div class="p-4 hover:bg-gray-50 transition-colors">
                                <div class="flex justify-between items-start">
                                    <div>
                                        <h3 class="font-medium text-gray-800">新用户注册活动开始</h3>
                                        <p class="text-gray-500 text-sm mt-1 line-clamp-2">
                                            为感谢新用户支持，即日起至6月30日，新注册用户可获得精选资源包一份，包含设计模板和开发工具合集。</p>
                                    </div>
                                    <span
                                        class="px-2 py-1 text-xs font-medium bg-gray-100 text-gray-800 rounded-full">已过期</span>
                                </div>
                                <div class="flex justify-between items-center mt-3">
                                    <span class="text-gray-500 text-xs">2023-05-20 14:20</span>
                                    <div class="flex space-x-1">
                                        <button class="btn-action text-gray-600 hover:text-primary" title="编辑">
                                            <i class="fa fa-edit"></i>
                                        </button>
                                        <button class="btn-action text-gray-600 hover:text-danger" title="删除">
                                            <i class="fa fa-trash"></i>
                                        </button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </main>
        </div>
    </div>

    <!-- 回到顶部按钮 -->
    <button id="backToTop"
        class="fixed bottom-6 right-6 w-12 h-12 rounded-full bg-primary text-white shadow-lg flex items-center justify-center opacity-0 invisible transition-all duration-300">
        <i class="fa fa-arrow-up"></i>
    </button>

    <script>
        // 回到顶部按钮功能
        const backToTopBtn = document.getElementById('backToTop');

        window.addEventListener('scroll', () => {
            if (window.scrollY > 300) {
                backToTopBtn.classList.remove('opacity-0', 'invisible');
                backToTopBtn.classList.add('opacity-100', 'visible');
            } else {
                backToTopBtn.classList.remove('opacity-100', 'visible');
                backToTopBtn.classList.add('opacity-0', 'invisible');
            }
        });

        backToTopBtn.addEventListener('click', () => {
            window.scrollTo({
                top: 0,
                behavior: 'smooth'
            });
        });

        // 移动端侧边栏切换
        const menuButton = document.querySelector('button.md\\:hidden');
        const sidebar = document.querySelector('aside');

        menuButton.addEventListener('click', function () {
            sidebar.classList.toggle('hidden');
            sidebar.classList.toggle('fixed');
            sidebar.classList.toggle('z-50');
            sidebar.classList.toggle('w-64');
        });
    </script>
</body>

</html>